package xby.study.annotations.demo1;

import java.util.Arrays;

/**
 * 测试注解的继承：   针对 【类】  上的注解,  注解的继承  ，一定是类， 接口不继承
 */
public class TestDemo {

    public static void main( String[] args) {
        System.out.println("爷爷");
        Arrays.stream(A.class.getAnnotations()).forEach(System.out::println);
        System.out.println("----------");
        Arrays.stream(A.class.getDeclaredAnnotations()).forEach(System.out::println);
        System.out.println("儿子");
        Arrays.stream(AA.class.getAnnotations()).forEach(System.out::println);
        System.out.println("----------");
        Arrays.stream(AA.class.getDeclaredAnnotations()).forEach(System.out::println);
        System.out.println("孙子");
        Arrays.stream(AAA.class.getAnnotations()).forEach(System.out::println);
        System.out.println("----------");
        Arrays.stream(AAA.class.getDeclaredAnnotations()).forEach(System.out::println);

        System.out.println("----------下一项");

        main2();


    }

    public static void  main2(){

        YouAnnotation y1=  A.class.getAnnotation(YouAnnotation.class);
        YouAnnotation y2=  AA.class.getAnnotation(YouAnnotation.class);
        YouAnnotation y3=  AAA.class.getAnnotation(YouAnnotation.class);

        System.out.println(y1==y2);
        System.out.println(y1==y3);
        System.out.println(y2==y3);


    }
}